/**
 * LockboxItem
 * Secret Item class
 *
 * Created by Nathan Black
 */
 
#import "LockboxItem.h"

@implementation LockboxItem

-initWithType:(enum LockboxItemType)_type
{
    if ((self = [super init])) {
        type = _type;
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)coder 
{ 
  self = [super init]; 
  type = [coder decodeIntForKey:@"type"]; 
  key = [[coder decodeObjectForKey:@"key"] retain]; 
  value = [[coder decodeObjectForKey:@"value"] retain]; 
  note = [[coder decodeObjectForKey:@"note"] retain]; 
  website = [[coder decodeObjectForKey:@"website"] retain]; 
  additionalInfo = [[coder decodeObjectForKey:@"additionalInfo"] retain]; 
  expDate = [[coder decodeObjectForKey:@"expDate"] retain]; 
  phone1 = [[coder decodeObjectForKey:@"phone1"] retain]; 

  return self; 
}

- (void)encodeWithCoder:(NSCoder *)coder 
{ 
  /*NSLog(@"encode: key 0x%08x", key);
  NSLog(@"encode: value 0x%08x", value);
  NSLog(@"encode: note 0x%08x", note);
  NSLog(@"encode: website 0x%08x", website);
  NSLog(@"encode: additionalInfo 0x%08x", additionalInfo);
  NSLog(@"encode: expDate 0x%08x", expDate);
  NSLog(@"encode: phone1 0x%08x", phone1);*/
  [coder encodeInt:type forKey:@"type"]; 
  [coder encodeObject:key forKey:@"key"]; 
  [coder encodeObject:value forKey:@"value"]; 
  [coder encodeObject:note forKey:@"note"]; 
  [coder encodeObject:website forKey:@"website"]; 
  [coder encodeObject:additionalInfo forKey:@"additionalInfo"]; 
  [coder encodeObject:expDate forKey:@"expDate"]; 
  [coder encodeObject:phone1 forKey:@"phone1"]; 
} 

- (NSMethodSignature*)methodSignatureForSelector:(SEL)selector {
 NSLog(@"LBItem: Requested method for selector: %@", NSStringFromSelector(selector));
 return [super methodSignatureForSelector:selector];
}

- (BOOL)respondsToSelector:(SEL)aSelector {
    NSLog(@"LBItem: Request for selector: %@", NSStringFromSelector(aSelector));
    return [super respondsToSelector:aSelector];
}

- (void)forwardInvocation:(NSInvocation *)anInvocation {
 NSLog(@"LBItem: Called from: %@", NSStringFromSelector([anInvocation selector]));
[super forwardInvocation:anInvocation];
}
@end